Ext.define('Admin.view.system.vote.Vote', {
	extend: 'Admin.ux.PageGrid',
    xtype: 'vote-view',
    title: '投票',
    viewModel: {
       stores: { 
	        data: {
	            type: 'vote-store',
	            autoLoad: true
	   		 }
	   		
	    },
		data:{
			giveAuthBtnStatus : true
		}
    },
    
    controller:'vote',
    listeners: {
        selectionchange: 'onSelectionChange'
    },
    
 	columns: [
	 	{ xtype: 'rownumberer',width:35},
	 	{ xtype:'hidden', text: 'id',dataIndex: 'id'},
	 	{ xtype:'gridcolumnview', text: '投票标题',width:120, dataIndex: 'vote_name'}, 
	 	{ xtype:'gridcolumnview', text: '投票描述',width:220, dataIndex: 'vote_content'},
	 	{ xtype:'gridcolumnview', text: '投票数',width:60, dataIndex: 'vote_count'}, 
	 	{ xtype:'gridcolumnview', text: '开始时间',width:100, dataIndex: 'start_time'}, 
		{ xtype:'gridcolumnview', text: '结束时间',width:100,dataIndex: 'end_time'}, 
	    {
	        menuDisabled: true,
	        sortable: false,
	        xtype: 'actioncolumn',
	        width: 80,
	        text:'操作',
	        items: [	
				{
				    iconCls: 'x-fa fa-vimeo-square',
				    tooltip: '投票',
				    handler:'voteAction'
				},
				'-',
				{
				    iconCls: 'array-grid-buy-col',
				    tooltip: '编辑',
				    handler:'editAction'
				},
				'-',
				{
				    iconCls: 'array-grid-sell-col',
				    tooltip: '删除',
				    handler: 'removeAction'
				}
			]
	    }
	],
	
    tbar:[
		{
			text:'创建投票',
			iconCls: 'x-fa fa-plus',
			handler:'addAction'
		},
		{
			text:'生成选项',
			iconCls: 'x-fa fa-gavel',
			bind:{
    			disabled :'{giveAuthBtnStatus}'
    		},
			handler:'autoAction'
		},
		{
			text:'查看选项',
			iconCls: 'x-fa fa-list-alt',
			bind:{
    			disabled :'{giveAuthBtnStatus}'
    		},
			handler:'showOptionAction'
		},
		{
			text:'投票日志',
			iconCls: 'x-fa fa-file-text-o',
			bind:{
    			disabled :'{giveAuthBtnStatus}'
    		},
			handler:'LogAction'
		},
		'->',
		{
			xtype : 'keysearchfield'
		}
	]
});
